Release 10.1A: OpenEdge Development:
Progress 4GL Handbook


Defining a CHOOSE trigger for your button

Now you need to write some code for Progress to execute when the user clicks the First button. You can cheat a little here and copy some code you’ve already looked at, because it uses some query syntax that you won’t read about in detail until a later chapter.

To define a CHOOSE trigger for your button:

  1. Click the Edit Code button to bring up the Section Editor, and go back to the procedure enable_UI.
  2. Copy the two statements (five lines of code in all) starting with GET FIRST CustQuery. Select the text by clicking and dragging the mouse over it, then press CTRL+C:
  3. Why do you select just these lines? The preprocessor value in the first line of the procedure opens the Customer query, and since it’s already open when the user clicks a button, you don’t need to do that again. Likewise, the fields and other objects in the window are enabled, so you don’t need to do that again either. (By the way, you might notice that your new BtnFirst button has already been added to the list of things to enable.) And the window has been viewed, so you don’t need that statement either. However, the statement before that, which opens the Order query, you do need, so you’ll go back and get that in a moment.

  4. Drop that same code into the trigger to execute when the user clicks the First button. You can get the Section Editor to move to that place in the procedure in two ways:
    • Back in the design window, select the First button by clicking on it, and then select the Edit Code icon again.
    • In the Section Editor, select Triggers as the Section type. This might bring up the correct trigger for you. If it doesn’t, then select BtnFirst from the drop-down list labeled OF:

In either case you get a starting point for some 4GL code defined within a DO-END block. You can see that the block of code is defined to execute ON CHOOSE OF BtnFirst.


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095